From 3bc9c4f98a5dea5afda3ad2aae243e88d12a7e09 Mon Sep 17 00:00:00 2001 From: Petre Eftime Date: Thu, 5 Apr 2018 12:49:23 +0000 Subject: [PATCH] python: xc: fix max_cpu_index sign error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When 0-indexing, maximum index is num_entries - 1. The python xc library had a sign error where the minus was replaced by a plus, making tools that depended on it to look for CPUs that did not exist. Signed-off-by: Petre Eftime Acked-by: Marek Marczykowski-Górecki Release-acked-by: Juergen Gross --- tools/python/xen/lowlevel/xc/xc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index f501764100..694bfa0642 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1079,7 +1079,7 @@ static PyObject *pyxc_topologyinfo(XcObject *self) } } - ret_obj = Py_BuildValue("{s:i}", "max_cpu_index", num_cpus + 1); + ret_obj = Py_BuildValue("{s:i}", "max_cpu_index", num_cpus - 1); PyDict_SetItemString(ret_obj, "cpu_to_core", cpu_to_core_obj); Py_DECREF(cpu_to_core_obj); -- 2.30.2